#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/ide.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/io.h>
#include <linux/uaccess.h>
#include <linux/string.h>
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>



/*

-- backlight
|   |-- brightness-levels
|   |-- compatible
|   |-- default-brightness-level
|   |-- name
|   |-- pwms
|   `-- status

*/
static int __init dtsof_Init(void)
{
    int rec =0;   
     struct device_node *bl= NULL;    
    struct property  *compro= NULL;
    printk("dts 1\n");

    /*    1。 先找到节点路径*/
    bl =  of_find_node_by_path("/backlight");
      printk("dts 2\n");
    if(bl == NULL)  
    {
         printk("dts 3\n");
        rec = -1;
        goto erro1;
    }
        /*2. 获取属性*/
    compro = of_find_property(bl,"compatible",NULL);
    if(compro == NULL)  
    {
          printk("dts 4\n");
        rec = -1;
        goto erro1;
    }
    else 
    {
       
    }
    printk("compatible = %s /n",(char *)compro->value);
    return 0;
erro1:    
    return rec;
}

static void __exit dtsof_exit(void)
{

}










module_init(dtsof_Init);
module_exit(dtsof_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("xyt");